local que_shuxiang = fk.CreateSkill {
    name = "que_shuxiang",
    anim_type = "control",
}
Fk:loadTranslationTable {
    ["que_shuxiang"] = "术相",
    [":que_shuxiang"] = "每回合限一次，当一名角色的判定牌生效前，你可以将此牌改为任意花色和点数。",
    ["#que_shuxiang-ask"] = "术相：你可以改变 %src 进行“%arg”判定的判定牌%arg2",
    ["#que_shuxiang-suit"] = "术相：选择花色",
    ["#que_shuxiang-number"] = "术相：选择点数",

}
que_shuxiang:addEffect(fk.AskForRetrial, {
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(que_shuxiang.name) and player:usedSkillTimes(que_shuxiang.name, Player.HistoryTurn) == 0
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        if room:askToSkillInvoke(player, {
                skill_name = que_shuxiang.name,
                prompt = "#que_shuxiang-ask:" .. target.id .. "::" .. data.reason .. ":" .. data.card:toLogString(), --判定牌data.reason
            }) then
            event:setCostData(self, { tos = { target } })
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local suits, numbers = { "log_spade", "log_heart", "log_diamond", "log_club" },
            { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13" }
        local suitMap = {
            ["log_spade"] = Card.Spade,
            ["log_heart"] = Card.Heart,
            ["log_diamond"] = Card.Diamond,
            ["log_club"] = Card.Club
        }

        local card = Fk:cloneCard(data.card.name)
        local suit = room:askToChoice(player,
            { choices = suits, skill_name = que_shuxiang.name, prompt = "#que_shuxiang-suit" })
        card.suit = suitMap[suit]
        card.color = table.contains({ Card.Diamond, Card.Heart }, card.suit) and Card.Red or Card.Black
        local number = room:askToChoice(player,
            { choices = numbers, skill_name = que_shuxiang.name, prompt = "#que_shuxiang-number" })
        card.number = tonumber(number) or 1

        local cid = data.card:getEffectiveId()
        if cid then
            card.subcards = { cid }
        end

        data.card = card

        room:sendLog {
            type = "#ChangedJudge",
            from = player.id,
            to = { data.who.id },
            arg2 = card:toLogString(),
            arg = que_shuxiang.name,
        }
    end,
})


return que_shuxiang
